package com.ljj.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import com.ljj.entity.Type;
import com.ljj.mapper.TypeMapper;
import com.ljj.service.ITypeService;
import com.ljj.utli.Result;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author liujiju
 * @since 2021-11-19
 */
@RestController
@RequestMapping("/type")
public class TypeController {
	@Autowired
	ITypeService istype;
	@Autowired
	TypeMapper m;
	
	/**
	 * 全查
	 * @param d
	 * @return
	 */
		@RequestMapping("/typegetList")
		public Object getList(Type te) {
			
			
			return istype.typegetList(te);
		}
		
		/**
		 * 添加
		 * @param c
		 * @return
		 */
		@RequestMapping("/typeadd")
		public Object typeadd(Type c) {
			if (m.insert(c) > 0) {
				return new Result(0, "添加成功");
			} else {
				return new Result(1, "添加失败");
			}
		}
	/**
	 * 修改
	 * @param 
	 * @return
	 */
		@RequestMapping("/typeupdate")
		public Object typepdate(Type d) {
			if (m.updateById(d) > 0) {
				return new Result(0, "修改成功");
			} else {
				return new Result(1, "修改失败");
			}

		}
		/**
		 * 修改
		 * @param 
		 * @return
		 * 
		 */
			@RequestMapping("/typedelete")
			public Object typedelete(Type d) {
				if (m.deleteById(d)> 0) {
					return new Result(0, "修改成功");
				} else {
					return new Result(1, "修改失败");
				}

			}
		
	
}
